#include "e2d/core/trans/components.h"
#include "e2d/core/Entity.h"

using namespace e2d::trans;

std::vector<std::string> Components::m_Labels= {
  
    e2d::TransformNode::_Label_(),
    e2d::Grid::_Label_(),
    e2d::AnimationClip::_Label_(),
    e2d::Animator::_Label_(),
    e2d::LayoutGrid::_Label_()
};


bool Components::AddComponent(e2d::Entity* entity,const e2d::ComponentType& type)
{
	bool flag{ 0 };
    flag |= entity->AddComponentFromType<e2d::TransformNode>(type);
    flag |= entity->AddComponentFromType<e2d::Grid>(type);
    flag |= entity->AddComponentFromType<e2d::AnimationClip>(type);
    flag |= entity->AddComponentFromType<e2d::Animator>(type);
    flag |= entity->AddComponentFromType<e2d::LayoutGrid>(type);

	return flag;
}

bool Components::CopyComponents(const e2d::Entity* source, e2d::Entity* target ,bool copyPosition)
{
    bool flag{0};

    if(copyPosition)
    {
     
        flag|=target->CopyComponent<e2d::TransformNode>(source);
        flag|=target->CopyComponent<e2d::Grid>(source);
   
    }
    flag|=target->CopyComponent<e2d::AnimationClip>(source);
    flag|=target->CopyComponent<e2d::Animator>(source);
    flag|=target->CopyComponent<e2d::LayoutGrid>(source);

    return flag;
}
